﻿using System;
using UnityEngine;
using UnityEngine.Events;

// Token: 0x020003B3 RID: 947
[RequireComponent(typeof(ToggleButton))]
public class MoveableToggleButton : MonoBehaviour
{
	// Token: 0x0600179D RID: 6045 RVA: 0x0009C484 File Offset: 0x0009A684
	private void Awake()
	{
		this.toggle = base.GetComponent<ToggleButton>();
		this.moveableUI.onChangeState.AddListener(new UnityAction<MoveableUI.STATE>(this.OnChangeState));
		this.toggle.ActionAddListener(new UnityAction<bool>(this.OnToggleChange));
	}

	// Token: 0x0600179E RID: 6046 RVA: 0x0009C4D0 File Offset: 0x0009A6D0
	private void Update()
	{
	}

	// Token: 0x0600179F RID: 6047 RVA: 0x0009C4D4 File Offset: 0x0009A6D4
	private void OnToggleChange(bool flag)
	{
		if (!this.invoke)
		{
			return;
		}
		if (flag)
		{
			this.moveableUI.Open();
		}
		else
		{
			this.moveableUI.Close();
		}
	}

	// Token: 0x060017A0 RID: 6048 RVA: 0x0009C504 File Offset: 0x0009A704
	private void OnChangeState(MoveableUI.STATE state)
	{
		this.invoke = false;
		this.toggle.Value = (this.moveableUI.State != MoveableUI.STATE.CLOSED);
		this.invoke = true;
	}

	// Token: 0x04001B2F RID: 6959
	[SerializeField]
	private MoveableUI moveableUI;

	// Token: 0x04001B30 RID: 6960
	private ToggleButton toggle;

	// Token: 0x04001B31 RID: 6961
	private bool invoke = true;
}
